package com.ys.service.sys;

import java.util.List;

import org.springframework.ui.Model;

import com.bo.dto.NameValueSelectDto;
import com.ys.dto.DtreeSqlDto;
import com.ys.vo.R;

import lombok.AllArgsConstructor;
import lombok.Data;

public interface YsGridColService {

	DtreeSqlDto dtree();
	
	R add(Long gridId,
			String name,
			String code,
			Integer sortNo,
			String frontType,
			Integer frontEdit,
			Integer frontWidth,
			Integer frontAlign,
			Integer frontShow,
			String dictKeyBase,
			String modalKey,
			String modalRelativeCode,
			String modalValueCode,
			Integer multyFileSourceType);
	
	R deleteTrue(Long id);
	
	String toSettingOption(Model model, Long id);
	@Data
	@AllArgsConstructor
	public static class ToSettingOptionDto{
		private Long id; // 子列表字段ID
		private String name; // 字段名
		private String code; // 字段编码
		private String dictKeyBase; // 字典KEY
		private List<RowDto> rows;
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字典ID
			private String dictName; // 字典名
			private String dictValue; // 字典值
		}
	}
	
	String toSettingForm(Model model, Long menuId);
	@Data
	@AllArgsConstructor
	public static class ToSettingFormDto{
		private Long menuId; // 
		private List<RowDto> rowsAdd;
		private List<RowDto> rowsEdit;
		
		@Data
		@AllArgsConstructor
		public static class RowDto {
			private Long id; // 字段ID
			private String code; // 字段编码
			private String name; // 字段名称
			private List<NameValueSelectDto> typeArr; // 字段类型
			private List<NameValueSelectDto> stateArr; // 是否开启
			private List<NameValueSelectDto> requiredArr; // 是否开启
		}
	}

	R settingOption(Long id, String dictKeyBase);
	
	String toSettingSelectorModal(Model model, Long colId);
	@Data
	@AllArgsConstructor
	public static class ToSettingSelectorModalDto{
		private Long id; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private SelectorModalInfoDto selectorModalInfo; // 弹出框配置信息

		@Data
		@AllArgsConstructor
		public static class SelectorModalInfoDto {
			private List<NameValueSelectDto> modalArr; // 弹出框数组
		}
	}

	R settingSelectorModal(Long id, Long idYsModalSelector);
	
	String toAddDictForSelector(Model model, Long colId);
	@Data
	@AllArgsConstructor
	public class ToAddDictOfSelectorDto{
		private Long colId; // 表格字段ID
		private String dictKey; // 字典KEY
	}
	
	String toSettingMultyFileSourceType(Model model, Long id);
	@Data
	@AllArgsConstructor
	public static class ToSettingMultyFileSourceTypeDto{
		private Long id; // ID
		private String name; // 字段名
		private String code; // 字段编码
		private List<NameValueSelectDto> rows;
	}

	R settingMultyFileSourceType(Long id, Integer multyFileSourceType);
	
	String toEditDictForSelector(Model model, Long dictId);
	@Data
	@AllArgsConstructor
	public class ToEditDictForSelectorDto{
		private Long dictId; // ID
		private String dictKey; // 字典KEY
		private String dictName; // 字典名称
		private String dictValue; // 字典值
	}

	R addDictForSelector(Long colId, String dictName, String dictValue);

	R editDictForSelector(Long dictId, String dictName, String dictValue);
}
